//Suggestion
var suggestion = {
		
		isClosed: true,
						
		init: function(){
			$("#suggestion").bind('click', function(event){
				if (suggestion.isClosed) {
					suggestion.isClosed = false;
					$("#tab").show("clip",{}, 800);
				} else {					
					$("a[class='sgClose r']").click();
				}
			});
			
			$("a[class='sgClose r']").bind('click', function(event){
				suggestion.isClosed = true;
				$("#tab").hide("clip",{}, 500);
			});
			
			$(".sgTab li").hover(
				function () {
					$(".sgTab li").removeClass("active");
					$(this).addClass("active");						
					$(".sgCont div").css({display:'none'});					
					$(".sgCont div#"+this.id).css({display:'block'});
				}
			);
			
			$("#sgarea").bind('click', function(event){
				$("#sgarea").val("");
				$("#sgarea").unbind("click");				
			});
			
			$("#sgsubmit").bind('click', function(event){
				var text = $.trim($("#sgarea").val());
				if (text.length == 0) {
					alert("请输入内容！");
					return;
				}
				if(text.length>200){
					alert("您输入的内容超过200字！");
					return;
				};
				var source = window.location.href;
				var option = { data: {"type": 1,"content":text, "source":source}, url: 'sgAction!save.action',
		                success: function (ret) {		                	
		                	rating.msgBox("谢谢您的建议,我们会尽快改进.");
		    				$("a[class='sgClose r']").click();
		                }                	               	            
				};
				$.ajax(option);				
			});						 	
		}
		
};